import { showConfirmDialog } from 'vant';

type ConfirmDialogType = {
  title: string;
  message: string;
  cancelTitle?: string;
  confirmTitle?: string;
};

export const confirmDialog = (config: ConfirmDialogType, confirmCallBack?: Function, cancelCallBack?: Function) => {
  return showConfirmDialog({
    title: config.title,
    message: `<span style="color: #222;font-size: 15px;font-weight: 500;">${config.message}</span>`,
    allowHtml: true,
    confirmButtonText: config.confirmTitle || '确定',
    confirmButtonColor: '#bf1920',
    cancelButtonText: config.cancelTitle || '取消',
    width: '300px'
  }).then(() => {
    confirmCallBack && confirmCallBack()
  }).catch(() => {
    cancelCallBack && cancelCallBack()
  })
    ;
};
